package com.ssy.lingxi.pay.api.feign;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.pay.api.dto.request.*;
import com.ssy.lingxi.pay.api.fallback.WeChatPayHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 微信支付内部接口
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/10/24
 */
@FeignClient(value = "pay-service", fallback = WeChatPayHystrix.class)
public interface IWeChatPayFeign {

    /**
     * 订单支付
     * @param mobilePayRequest 接口参数
     * @return 支付二维码
     */
    @RequestMapping(value = "/pay/weChat/orderPay", method = RequestMethod.POST)
    Wrapper<String> orderPay(@RequestBody MobilePayRequest mobilePayRequest);

    /**
     * 查询订单
     * @param weChatOrderQueryRequest 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/pay/weChat/orderQuery", method = RequestMethod.POST)
    Wrapper<Object> orderQuery(@RequestBody WeChatOrderQueryRequest weChatOrderQueryRequest);

    /**
     * 关闭订单
     * @param weChatCloseOrderRequest 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/pay/weChat/closeOrder", method = RequestMethod.POST)
    Wrapper<Object> closeOrder(@RequestBody WeChatCloseOrderRequest weChatCloseOrderRequest);

    /**
     * 申请退款
     * @param weChatRefundRequest 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/pay/weChat/refund", method = RequestMethod.POST)
    Wrapper<Object> refund(@RequestBody WeChatRefundRequest weChatRefundRequest);

    /**
     * 查询退款
     * @param weChatRefundQueryRequest 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/pay/weChat/refundQuery", method = RequestMethod.POST)
    Wrapper<Object> refundQuery(@RequestBody WeChatRefundQueryRequest weChatRefundQueryRequest);
}
